package com.ksc.storekeeper.server.repositories;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.ksc.storekeeper.server.entities.Product;

public interface ProductRepository extends CrudRepository<Product, Long>{

	@Query("select p from Product p where p.code=?")
	Product findByCode(String code);
	
	@Query("select p from Product p where p.category.name=?")
	List<Product> findByCategory(String categoryName);
}
